/*!
\copyright  Copyright (c) 2019-2025 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\defgroup   microphones Microphones
\ingroup    audio_domain
\brief      Microphone configuration default fallback values
*/

#ifndef MIC_CONFIG_DEFAULT_H
#define MIC_CONFIG_DEFAULT_H

#include <kymera_chain_roles.h>
#include "microphones_config.h"

static const microphones_bias_config_t platform_mic_bias_config[] = {
    { .id=BIAS_CONFIG_MIC_BIAS_0, .voltage=3 },
    { .id=BIAS_CONFIG_MIC_BIAS_1, .voltage=3 }
};

static const unsigned platform_num_bias = ARRAY_DIM(platform_mic_bias_config);

/*! Microphone roles:
 * These can be used by the application to find a specific microphone.
 * There's no assumption about what a "role" represents. I.e. roles can be based on function, location, etc.
 * There are some roles defined in \see mic_role_t which parts of the ADK use and there is a reserved range for customer use.
 * The list can also contain chain Endpoint Roles, the Kymera audio use case code (e.g. \see kymera_sco.c, \see kymera_le_voice.c)
 * will now attempt to map chain input Endpoint Roles to microphones based on the roles defined here via Kymera_MapMicsToChainInputs() \see kymera_connect_utils.h
 * 
*/
static const int mic0_roles[] = {
    MIR_VOICE,
    EPR_VA_MIC_MIC1_IN,
    MIR_VOICE_LEFT,
    MIR_LEAKTHROUGH,
    MIR_ANC_FEED_FORWARD,
    MIR_ANC_FEED_FORWARD_LEFT,

    EPR_CVC_SEND_IN1,
    EPR_RATE_ADJUST_IN1,
    EPR_MIC_MIC1_IN,
    EPR_AANC_FBC_FF_MIC_IN,
};

static const int mic1_roles[] = {
    MIR_VOICE_RIGHT,
    MIR_EXTERNAL,
    EPR_VA_MIC_MIC2_IN,

    MIR_ANC_FEED_FORWARD_RIGHT,

    EPR_CVC_SEND_IN2,
    EPR_RATE_ADJUST_IN2
};

static const int mic2_roles[] = {
    MIR_INTERNAL,
    MIR_INTERNAL_BCM,

    EPR_CVC_SEND_IN3,
    EPR_RATE_ADJUST_IN3
};

static const microphones_mic_config_t platform_microphone_configs[] = {
    {
        .params = {
            .bias_config = BIAS_CONFIG_MIC_BIAS_0,
            .pio = 19,
            .type = mic_type_analog,
            .instance = AUDIO_INSTANCE_0,
            .channel = AUDIO_CHANNEL_A,
        },
        .roles = mic0_roles,
        .num_roles = ARRAY_DIM(mic0_roles),
    },
    {
        .params = {
            .bias_config = BIAS_CONFIG_MIC_BIAS_0,
            .pio = 22,
            .type = mic_type_analog,
            .instance = AUDIO_INSTANCE_0,
            .channel = AUDIO_CHANNEL_B,
        },
        .roles = mic1_roles,
        .num_roles = ARRAY_DIM(mic1_roles),
    },
    {
        .params = {
            .bias_config = BIAS_CONFIG_PIO,
            .pio = 4,
            .type = mic_type_digital,
            .instance = AUDIO_INSTANCE_1,
            .channel = AUDIO_CHANNEL_A,
        },
        .roles = mic2_roles,
        .num_roles = ARRAY_DIM(mic2_roles),
    },
    {
        .params = {
            .bias_config = BIAS_CONFIG_PIO,
            .pio = 4,
            .type = mic_type_digital,
            .instance = AUDIO_INSTANCE_1,
            .channel = AUDIO_CHANNEL_B,
        },
    },
    {
        .params = {
            .bias_config = BIAS_CONFIG_MIC_BIAS_0,
            .pio = 0,
            .type = mic_type_digital,
            .instance = AUDIO_INSTANCE_2,
            .channel = AUDIO_CHANNEL_A,
        },
    },
    {
        .params = {
            .bias_config = BIAS_CONFIG_MIC_BIAS_0,
            .pio = 0,
            .type = mic_type_digital,
            .instance = AUDIO_INSTANCE_2,
            .channel = AUDIO_CHANNEL_B,
        }
    }
};

static const unsigned platform_num_mics = ARRAY_DIM(platform_microphone_configs);

#endif /*MIC_CONFIG_DEFAULT_H*/
